import Cookies from 'vue-cookies'
const permission = {
    state:{
        // 所有权限放在一个数组中，只能对页面进行权限控制,可进行角色、页面code控制。例：["admin","student","teacher"]
        permission1:[
            "About","news"
        ],
        // 所有权限放在对象数组中，可以操作页面的增删查改，可进行页面code与增删查改控制。例：[{code:"user",CRUD:["add","delete","updeate","select"]}]
        // permission2:Cookies.get("permission2") ? JSON.parse(Cookies.get("permission2")) : [],
        permission2:[
            {code:"About",CRUD:["add","delete"]},
            {code:"news",CRUD:["add","delete"]}
        ],
    },
    mutations:{
        setPermission1(state,data){
            state.permission1 = data
            Cookies.set("permission1",data)
        },
        setPermission2(state,data){
            state.permission2 = data
            Cookies.set("permission2",data)
        },
    },
    getters:{},
    actions:{},
    modules: {}
}
export default permission
